package com.xyd.springcloud.controller;


import com.xyd.springcloud.config.RestFulTemplate;
import com.xyd.springcloud.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/all")
    public List<User> getAllUsers() {
        return restTemplate.getForObject("http://localhost:8081/all", List.class);
    }
}
